package factory_method;

/**
 * @author ChrisHao
 * @date 2025/1/25 09:35
 */
public class Main {
    static Creator product = null;

    public static void initProduct() {
        String productConfig = "B";
        if (productConfig.equals("A")) {
            product = new ConcreteCreatorA();
        } else if (productConfig.equals("B")) {
            product = new ConcreteCreatorB();
        } else {
            throw new RuntimeException("Invalid product config");
        }
    }

    public static void main(String[] args) {
        initProduct();

        product.someOperation();
    }
}
